/*
 * PaymentsFacade.java
 *
 * Created on 7 de Julho de 2007, 14:44
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.com.ecs.persistence.facade;

import br.com.ecs.persistence.entity.Payments;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Danielle
 */
@Stateless
public class PaymentsFacade implements PaymentsFacadeLocal {

    @PersistenceContext
    private EntityManager em;
    
    /** Creates a new instance of PaymentsFacade */
    public PaymentsFacade() {
    }

    public void create(Payments payments) {
        em.persist(payments);
    }

    public void edit(Payments payments) {
        em.merge(payments);
    }

    public void destroy(Payments payments) {
        em.merge(payments);
        em.remove(payments);
    }

    public Payments find(Object pk) {
        return (Payments) em.find(Payments.class, pk);
    }

    public List findAll() {
        return em.createQuery("select object(o) from Payments as o").getResultList();
    }
    
}
